package HLLibClasses;

import HLCode.HLClassManager;
import HLCode.HLLibClass;
import HLCode.HLObject;
import HLLib.base.HLString;
import HLLib.socket.HLSocketClient;
import HLLib.socket.HLSocketObject;

public class HLClassSocketClient extends HLLibClass {
    public HLClassSocketClient(HLClassManager owner) {
        super(owner);
    }

    public HLObject NewObject() {
        return new HLSocketClient();
    }

    public void Execute(HLObject self, int index, HLObject args, HLObject resultOwnerObject, int resultIndex) {
        switch (index) {
        case 0: {
            if (resultOwnerObject == null) {
                ((HLSocketClient) self).Connect((HLString)args.GetObject(0), args.GetInt(0));
            } else {
                resultOwnerObject.SetBoolean(resultIndex, ((HLSocketClient) self).Connect((HLString)args.GetObject(0), args.GetInt(0)));
            }
            break;
        }
        case 1: {
            ((HLSocketClient) self).DisConnect();
            break;
        }
        case 2: {
            ((HLSocketClient) self).Send((HLSocketObject)args.GetObject(0));
            break;
        }
        case 3: {
            ((HLSocketClient) self).run();
            break;
        }
        }
    }
}
